<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<html>
<head>
<title>出纳付款管理</title>
<%@include file="/common/ec.jsp"%>
<%@include file="/common/meta.jsp"%>
<script type="text/javascript">
</script>
</head>
<body>
<div class="x-panel">
<div class="x-panel-header">【借款】出纳付款管理</div>
<div class="x-toolbar">
  <table width="99%">
        <tr>
        <s:form action="cashierPayIndex" theme="simple" id="form1">
	      <td width="60">付款状态：</td>
	      <td width="90"><s:select list='isPayMap' name="model.payStatus" cssStyle="width:80px" headerKey="" headerValue="全部"></s:select></td>        
          <!--<td width="220">借款单号：<s:textfield name="model.singleNo" cssStyle="width:150px;" /></td>-->
          <td width="60">开始日期：</td>
          <td width="100"><input id="startDate" name="startDate" size="12" value="<s:date name='startDate' format='yyyy-MM-dd'/>" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'endDate\')}',skin:'whyGreen',dateFmt:'yyyy-MM-dd'})" class="Wdate"  readonly="readonly"/>&nbsp;&nbsp;</td>
          <td width="60">结束日期：</td>
          <td width="100"><input id="endDate" name="endDate" size="12" value=" <s:date name='endDate' format='yyyy-MM-dd'/>" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'startDate\')}',skin:'whyGreen',dateFmt:'yyyy-MM-dd'})" class="Wdate"  readonly="readonly"/></td>
          <td><s:submit value="查询" cssClass="button" cssStyle="width:45px;"></s:submit></td>          
        </s:form>
        </tr>
      </table>
</div>
<div class="x-panel-body">
<ec:table items="items" var="item" retrieveRowsCallback="limit" sortRowsCallback="limit" 
	    action="cashierPayIndex.do"
		useAjax="true" doPreload="false"
		maxRowsExported="10000000" 
		pageSizeList="15,50,100" 
		editable="false" 
		sortable="false"	
		rowsDisplayed="15"	
		generateScript="true"	
		resizeColWidth="true"	
		classic="false"	
		width="100%" 	
		height="400px"	
		minHeight="400"
		toolbarContent="navigation|pagejump|pagesize|refresh|extend|status">
	<ec:row> 
	    <ec:column width="30" property="_s" title="No." value="${GLOBALROWCOUNT}" sortable="false" style="text-align:center"/>
		<ec:column width="120" property="_singleNo" title="借款单号" ellipsis="true">
		    <a href="${ctx}/borrow/view.do?model.id=${item.id}" target="_blank" title="${item.title}"><font color="blue">${item.singleNo}</font></a>	
		</ec:column>
	    <ec:column width="100" property="dept.name" title="部门名称" style="text-align:center"/>	
	    <ec:column width="120" property="project.name" title="项目名称" ellipsis="true"/>			
	    <ec:column width="100" property="item.name" title="财务科目" ellipsis="true"/>			
	    <ec:column width="70" property="borrower.name" title="借款人" style="text-align:center"/>	
		<ec:column width="80" property="createDate" title="借款时间" style="text-align:center" cell="date"/>
		<ec:column width="70" property="amount" title="借款金额" style="text-align:right" format="#####0.00" cell="number"/>			

		<ec:column width="70" property="_payStatus" title="付款状态" style="text-align:center" mappingItem="payStatusMap">
		  <s:if test="#attr.item.payStatus == 0"><font color="red">未付款</font></s:if>
		  <s:if test="#attr.item.payStatus == 1"><font color="green">已付款</font></s:if>
		</ec:column>					
		<ec:column width="75" property="_0" title="操作" style="text-align:center" sortable="false">
		    <c:choose>
		      <c:when test="${item.payStatus != '0'}">
			       <font color="#999999">付款</font>	 | 	      	     
		      </c:when>
		      <c:otherwise>
		        <a href="#" onclick="doPay('${item.id}')">付款</a> | 	  	 
		      </c:otherwise>
		    </c:choose>		   
		    <a href="${ctx}/borrow/view.do?model.id=${item.id}" target="_blank">查看</a>	
		</ec:column>
	</ec:row>
</ec:table>
</div>
</div>
<script type="text/javascript">
function doPay(borrowId) {
	if (confirm("您确认要付款此借款申请单吗？")){
		window.location.href="${ctx}/borrow/doPayBorrow.do?model.id=" + borrowId;
	}
}
</script>
</body>
</html>